/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package yinshi.fsm;

import java.util.HashMap;
import java.util.Map;
import java.util.NoSuchElementException;

/**
 *
 * @author yinshi
 */
public class StateMachine<T> extends Sequence {

    private final Map<String, Group> groups = new HashMap<>();
    private Group entry;
    private boolean compiled = false;

    public StateMachine(Sequence sqc) {
    }

    public Group newGroup(String name) {
        checkGroupName(name);

        Group g = new Group();
        groups.put(name, g);
        return g;
    }

    public Group getGroup(String name) {
        return groups.get(name);
    }

    public void setEntry(String name) {
        Group g = groups.get(name);
        if (g == null) {
            throw new NoSuchElementException(name);
        }
        entry = g;
    }

    public void compile() {
    }

    private static void checkGroupName(String name) {
    }

    public boolean hasNext() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public Object next() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public Object look() {
        throw new UnsupportedOperationException("Not supported yet.");
    }
}
